class IUP_MESSAGE_ALARM
-- Shows a modal dialog containing a question message, similar
-- to IUP_ALARM.

create {ANY}
	message_alarm_with_parent,
   message_alarm
	
feature {ANY}

	message_alarm_with_parent (parent: IUP_DIALOG; title, message, buttons: STRING): INTEGER
		-- hows a modal dialog containing a question message, similar to
		-- IUP_ALARM.
		--
		-- parent: parent dialog.
		-- title: dialog’s title. It can be a language pre-defined string
		-- without the "_@" prefix.
		-- message: text message contents. It can be a language pre-defined 
		-- string without the "_@" prefix.
		-- buttons: list of buttons. Can have values: "OK", "OKCANCEL", 
		-- "RETRYCANCEL", "YESNO", or "YESNOCANCEL".
		--
		-- Returns: the number of the button selected by the user (1, 2 or 3).
		--
		-- The dialog is shown centered relative to its parent.
		require
			is_valid_buttons(buttons)
		do
			Result := int_message_alarm (parent.widget, title.to_external,
			                             message.to_external, buttons.to_external)
		end

	message_alarm (title, message, buttons: STRING): INTEGER
		-- The title defaults to "Attention!" and tries the global attribute 
		-- "PARENTDIALOG" as the parent dialog.
		require
			is_valid_buttons(buttons)
		local
			p: POINTER
		do
			Result := int_message_alarm (p, title.to_external,
			                             message.to_external, buttons.to_external)
		end
	
feature {}

	-- Internal
	
	int_message_alarm (wgt, t, m, b: POINTER): INTEGER
		external "plug_in"
      alias "{
         location: "${sys}/plugins"
         module_name: "iup"
         feature_name: "IupMessageAlarm"
         }"
      end
	
end -- class IUP_MESSAGE_ALARM

-- The MIT License (MIT)

-- Copyright (c) 2017 by German A. Arias

-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in 
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
